const express = require('express');
const App = express();

App.use((req, res, next) => {
    console.log('服务器2启动了');
    next()
})

App.get('/cars',(req, res) => {
    const cars = [
        {id:'001',name:'红旗',price:188},
        {id:'002',name:'捷豹',price:88},
        {id:'003',name:'丰田',price:66}
    ]
    res.send(cars)
})

App.listen(5001, (err) => {
    if(!err) console.log('服务启动成功！http://localhost:5001');
})